package com.tcm.controller.front;

import com.tcm.entity.resp.R;
import com.tcm.service.StatisticsService;
import com.tcm.utils.AccessTokenUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Guqier
 * @version 1.0
 * @date 2023/9/28 14:23
 */
@RestController
@RequestMapping("/stu/statistics")
@RequiredArgsConstructor
public class StuStatisticsController {

    private final StatisticsService statisticsService;

    /**
     * 获取学生学习统计信息
     * @param request 请求对象
     * @return 学生学习统计信息
     */
    @RequestMapping(method = RequestMethod.GET)
    public R getStuLearningStatistics(HttpServletRequest request){
        return R.success(statisticsService.getStuLearningStatistics(AccessTokenUtil.getUserId(request)));
    }

}
